package org.example.Controller;

import org.example.Pojo.Address;
import org.example.Service.Impl.AddressServiceImpl;
import org.example.Utils.UnionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Address")
public class AddressController {
    @Autowired
    AddressServiceImpl addressServiceImpl;
    @RequestMapping("/getMyAddress")
    public UnionResult getMyAddress(String userid) {
        return addressServiceImpl.getAllMyAddress(userid);
    }
    @RequestMapping("/getAddress")
    public UnionResult getAddress(Address address) {
        return addressServiceImpl.getAddress(address);
    }
    @RequestMapping("/deleteAddress")
    public UnionResult deleteAddress(Address address) {
        return addressServiceImpl.deleteAddress(address);
    }
    @RequestMapping("/updateAddress")
    public UnionResult updateAddress(Address address) {
        return addressServiceImpl.updateAddress(address);
    }
    @RequestMapping("/addAddress")
    public UnionResult addAddress(Address address) {
        System.out.println(address.getUserid());
        return addressServiceImpl.addAddress(address);
    }

}
